<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
description('Test Promise resolve inside Blink.');

window.jsTestIsAsync = true;

var result;
var resolve;
var promise = new Promise(function(res) { resolve = res; });
var blinkPromise = internals.createResolvedPromise(promise);

promise.then(function(value) {
    return blinkPromise;
}).then(function(value) {
    result = value;
    shouldBe('result', '42');
}).then(finishJSTest, finishJSTest);

resolve(42);

</script>
</body>
</html>
